﻿@helper FlashMessage(System.Web.Mvc.TempDataDictionary tempData){
    var message = "";
    var className = "";
    if (tempData["info"] != null)
    {
        message = tempData["info"].ToString();
        className = "alert alert-info";
    }
    else if (tempData["warning"] != null)
    {
        message = tempData["warning"].ToString();
        className = "alert alert-block";
    }
    else if (tempData["error"] != null)
    {
        message = tempData["error"].ToString();
        className = "alert alert-error";
    }
    else if (tempData["success"] != null)
    {
        message = tempData["success"].ToString();
        className = "alert alert-success";
    }    
    if (!String.IsNullOrEmpty(message))
    {

        <script type="text/javascript">
            $(document).ready(function() {
            $('p#flashmessage').html('@message');
            $('#flash').slideDown();
            $('.close').click(function () { $('#flash').slideUp() });
            });
        </script>
        <div id="flash" class="@className" style="display:none">
            <button type="button" class="close" data-dismiss="@className">×</button>
            <p id="flashmessage">@message</p>
        </div>         
    }
}